#ifndef S21_DECIMAL_H
#define S21_DECIMAL_H

#include <stdio.h>

#define TRUE 1
#define FALSE 0
#define OK 0
#define ERROR 1
#define POSITIVE_INF_ERROR 1
#define NEGATIVE_INF_ERROR 2
#define NAN_ERROR 3
#define POSITIVE 0
#define NEGATIVE 1
#define EPSILON 1e-04
#define INT_MAX 2147483647
#define INT_MIN (-INT_MAX - 1)
#define TOO_SMALL 1E-28
#define TOO_BIG 79228162514264337593543950335.0
#define ALL_BIT 0b11111111111111111111111111111111

#define LAST 3
#define MAX_INDEX (32 * LAST - 1)
#define INIT_ZERO_S21_DECIMAL \
  {                           \
    { 0, 0, 0, 0 }            \
  }

typedef struct {
  int bits[LAST + 1];
} s21_decimal;

#include "decimal_private.h"

int s21_add(s21_decimal value_1, s21_decimal value_2, s21_decimal *result);
int s21_sub(s21_decimal value_1, s21_decimal value_2, s21_decimal *result);
int s21_mul(s21_decimal value_1, s21_decimal value_2, s21_decimal *result);
int s21_div(s21_decimal value_1, s21_decimal value_2, s21_decimal *result);

int s21_is_less(s21_decimal value_1, s21_decimal value_2);
int s21_is_less_or_equal(s21_decimal value_1, s21_decimal value_2);
int s21_is_greater(s21_decimal value_1, s21_decimal value_2);
int s21_is_greater_or_equal(s21_decimal value_1, s21_decimal value_2);
int s21_is_equal(s21_decimal value_1, s21_decimal value_2);
int s21_is_not_equal(s21_decimal value_1, s21_decimal value_2);

int s21_from_int_to_decimal(int source, s21_decimal *destination);
int s21_from_float_to_decimal(float source, s21_decimal *destination);
int s21_from_decimal_to_int(s21_decimal source, int *destination);
int s21_from_decimal_to_float(s21_decimal source, float *destination);

int s21_floor(s21_decimal value, s21_decimal *result);
int s21_round(s21_decimal value, s21_decimal *result);
int s21_truncate(s21_decimal value, s21_decimal *result);
int s21_negate(s21_decimal value, s21_decimal *result);

#endif